package com.eastfair.projectcore.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 项目
 * </p>
 *
 * @author ligang
 * @since 2021-11-03
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_project_db")
@ApiModel(value = "ProjectDb", description = "项目")
@AllArgsConstructor
public class ProjectDb extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 项目名称
     */
    @ApiModelProperty(value = "项目名称")
    @Size(max = 255, message = "项目名称长度不能超过255")
    @TableField(value = "name", condition = LIKE)
    @Excel(name = "项目名称")
    private String name;

    /**
     * 项目英文名
     */
    @ApiModelProperty(value = "项目英文名")
    @Size(max = 255, message = "项目英文名长度不能超过255")
    @TableField(value = "en_name", condition = LIKE)
    @Excel(name = "项目英文名")
    private String enName;

    /**
     * 项目编码
     */
    @ApiModelProperty(value = "项目编码")
    @NotEmpty(message = "请填写项目编码")
    @Size(max = 255, message = "项目编码长度不能超过255")
    @TableField(value = "code", condition = LIKE)
    @Excel(name = "项目编码")
    private String code;

    /**
     * 行业
     */
    @ApiModelProperty(value = "行业")
    @Size(max = 32, message = "行业长度不能超过32")
    @TableField(value = "industry_id", condition = LIKE)
    @Excel(name = "行业")
    private String industryId;

    /**
     * 主办
     */
    @ApiModelProperty(value = "主办")
    @Size(max = 64, message = "主办长度不能超过64")
    @TableField(value = "organizer", condition = LIKE)
    @Excel(name = "主办")
    private String organizer;

    /**
     * 英文主办
     */
    @ApiModelProperty(value = "英文主办")
    @Size(max = 255, message = "英文主办长度不能超过255")
    @TableField(value = "en_organizer", condition = LIKE)
    @Excel(name = "英文主办")
    private String enOrganizer;

    /**
     * DB后缀名
     */
    @ApiModelProperty(value = "DB后缀名")
    @TableField(value = "db_suffix")
    @Excel(name = "DB后缀名")
    private Integer dbSuffix;

    /**
     * 表后缀名
     */
    @ApiModelProperty(value = "表后缀名")
    @TableField(value = "table_suffix")
    @Excel(name = "表后缀名")
    private Integer tableSuffix;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enabled")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnabled;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDeleted;

    /**
     * 是否为项目管理员 1是 0否
     */
    @ApiModelProperty(value = "是否为项目管理员 1是 0否")
    @TableField(value = "is_admin")
    @Excel(name = "是否为项目管理员 1是 0否")
    private Integer isAdmin;


    @Builder
    public ProjectDb(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy, 
                    String name, String enName, String code, String industryId, String organizer, 
                    String enOrganizer, Integer dbSuffix, Integer tableSuffix, Integer isEnabled, Integer isDeleted, Integer isAdmin) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.name = name;
        this.enName = enName;
        this.code = code;
        this.industryId = industryId;
        this.organizer = organizer;
        this.enOrganizer = enOrganizer;
        this.dbSuffix = dbSuffix;
        this.tableSuffix = tableSuffix;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.isAdmin = isAdmin;
    }

}
